<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <title>购物车</title>
    <script src="<?php echo base_url('static/plugins/jquery-1.10.2.min.js')?>" type="text/javascript"></script>
    <style type="text/css">
    	* {
		    margin: 0;
		    padding: 0;
		    padding-bottom: 0px;
		    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  			-webkit-tap-highlight-color: transparent;
  			
  				-webkit-touch-callout:none;  /*系统默认菜单被禁用*/     
			    -webkit-user-select:none; /*webkit浏览器*/     
			    -khtml-user-select:none; /*早期浏览器*/     
			    -moz-user-select:none;/*火狐*/     
			    -ms-user-select:none; /*IE10*/     
			    user-select:none; 
		}
		*:hover,*:active{
			-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  			-webkit-tap-highlight-color: transparent;
		}
		
		input {        
		     -webkit-user-select:auto; /*webkit浏览器*/       
		}  
    	body{
    		background-color: #ebebeb;
    		font-szie:14px;
    		line-height: 1;
    		padding-bottom:3em;
    		width:99%;
    		font-family: -apple-system-font, "Helvetica Neue", sans-serif;
    		line-height: 1;
    	}
    	
    	.weui-form-preview {
		    position: relative;
		    background-color: #FFFFFF;
		    margin-bottom:0.7em;
		}
		
		.weui-form-preview__bd {
		    padding: 10px 0 0 15px;
		    font-size: .9em;
		    text-align: right;
		    color: #999999;
		    line-height: 2;
		}
    	
   		.header{
			border-bottom: 1px solid rgba(230,230,230,0.5);
			width:100%;
			position: relative;
			height:2em;
   		} 	
   		.form-select{
    width: 1.1em;
    text-align: left;
    position: absolute;
    top: 0em;
    left: 0;
    z-index: 0;
   		}
   		
   		.store-icon{
   			width:1.2em;	
   			text-align:left;
   			position: absolute;
   			top:0;
   			left:2em;
   		}
   		
   		.store-icon img{
   			width:100%;
   		}
   		
   		.store-name{
   			    width: 93%;
			    text-align: left;
			    line-height: 2.1em;
			    position: absolute;
			    top: -0.3em;
			    left: 7%;
			    padding-left: 2.2em;
			    -moz-box-sizing: border-box;
			    -webkit-box-sizing: border-box;
			    -o-box-sizing: border-box;
			    -ms-box-sizing: border-box;
			    box-sizing: border-box;
			    padding-right: 2.4em;
			    padding-top: 0;
			    font-size: 1.1em;
			    font-weight: blod;
			    font-family: "PingFang";
			    color: #000;
			    overflow: hidden;
			    text-overflow: ellipsis;
			    white-space: nowrap;
			    /* position: absolute; */
			    /* z-index: -1; */
   		}
   		
   		.action-btn{
   			/*width:2em;*/	
   			text-align:left;
   			height:1.3em;
   			position: absolute;
   			top:0;
   			right:15px;
   			padding-top:0;
   		}
   		
   		
   	    .form-select img{
   			width:100%;
   		}
   		
   		.item{width:100%;position: relative;height:6em;padding: 1rem 0 0.2rem 0;overflow: hidden;font-family: "PingFang";}
   		.item:after{position:absolute;display:block;content:"";right:-15px;bottom:0;height:0.5px;width:97%;background:rgba(230,230,230,0.5);}
   		.item .form-select{height:100%;padding-top:1.5em;top:1em;}
   		.product-pic{
			width:5em;	
   			height:5em;
   			position: absolute;
   			top:1em;
   			left:2em;
   			/*padding:1em 0;*/
   		}
   		
   		.product-pic img{
   			width:100%;
   			height:100%;
   			border-radius:0.2em;
   		}
   		
   		.product-right{
			    position: absolute;
			    padding-left: 6.75em;
			    -moz-box-sizing: border-box;
			    -webkit-box-sizing: border-box;
			    -o-box-sizing: border-box;
			    -ms-box-sizing: border-box;
			    text-align: left;
			    line-height: 1.2em;
			    color: #000;
			    padding-right: 15px;
			    left:1.1em;
			    width:100%;
   		}
   		
   		.product-right .name{
   			width:100%;
   			font-size:0.9em;
   			text-overflow: -o-ellipsis-lastline;
			overflow: hidden;
			text-overflow: ellipsis;
			/*display: -webkit-box;*/
			-webkit-line-clamp: 2;
			-webkit-box-orient: vertical;
			height: 2.5em;
    		line-height: 1rem;
    		font-family: "PingFang";
  			color: rgb(51, 51, 51);
   		}
   		
   		.product-right .price{
   			width:100%;
   			/*height:1em;
   			bottom:-0.5em;
   			position: absolute;*/
   			-moz-box-sizing: border-box;  /*Firefox3.5+*/ 
 			-webkit-box-sizing: border-box; /*Safari3.2+*/ 
 			-o-box-sizing: border-box; /*Opera9.6*/
 			-ms-box-sizing: border-box; /*IE8*/ 
 			/*padding-right:8em;*/
   		}
   		
   		.product-right .attribute{
   			
   			margin:0.1rem 0 0.3rem 0;
   			font-size:0.8em;
   			color:rgb(153,153,153);
   			width:100%;
   			overflow: hidden;
			text-overflow:ellipsis;
			white-space: nowrap;
   		}
   		
   		.product-right .attribute .down{
   			display:none;
   		}
   		
   		.product-right .attribute.edit{
 			position: relative;
 			margin-top:1.6rem;	
 			padding-right:8em;
 			-moz-box-sizing: border-box;  /*Firefox3.5+*/ 
 			-webkit-box-sizing: border-box; /*Safari3.2+*/ 
 			-o-box-sizing: border-box; /*Opera9.6*/
 			-ms-box-sizing: border-box; /*IE8*/ 
 		}
 		
   		.product-right .attribute.edit .down{
 			position: absolute;
 			top:0;
 			right:7.5em;	
 			display: block;
 		}
 		
 		.product-right .attribute.edit .down img{
 			width:1em;
 		}
   		
   		.product-right .price .money{
   			font-size:1em;
   			/*font-weight:600;*/
   			float:left;
   			color: rgb(193, 54, 56);
  			font-weight: bold;
  			font-family: "PingFang";
  			
   		}
   		.product-right .price .money span{
   		}
   		.product-right .price .Market-money{
   			font-size:0.7em;
   			color:grey;
   			text-decoration:line-through;
   			float:left;
   			margin-left:0.75em;
   			font-family: "PingFang";
   			
   		}
   		
   		.product-right .price .Number{
   			font-size:0.7em;
   			color:rgb(153,153,153);
   			float:right;
   			margin-right:2em;
   		}
   		.line{
   			width:100%;
   			position: relative;
   			overflow: hidden;
   			padding-left:1.5em;
 		}
   		.line div{
   			 border-bottom: 1px solid #ddd;
   			 margin:1em 0 0.2em 0;
   			 width:100%;
 		}
 		
 		.item .delete-btn{
			position: absolute;
			    height: 6.5rem;
			    line-height: 6.5rem;
			    background-color: red;
			    width: 5em;
			    text-align: center;
			    top: -1rem;
			    right: 1em;
			    /* padding: 0 0.6rem; */
			    color: #FFFFFF;
 		}
 		.select-number{
 			padding-top:0.2rem;
 			
 		}
 		.select-number div{float:left;}
 		.select-number:after{clear:both;content:'';display:block;}
 		.select-number .number{margin:0 0.5em;}
 		.m-1.subtract{margin-top:0;}
 		.select-number img{width:100%;margin:0;}
 		.hide{display:none;}
 		.m-1{
 			/*width:25%;
 			float:left;*/
 		}
 		
 		.left{text-align:left;}
 		.right{text-align:right;}
 		.m-2{
 			/*width:50%;
 			float:left;*/
 			text-align:center;
 		}
 		.m-1.subtract{
 			margin-top:0em;
 		}
 		.m-1 img{width:1.45em;}
 		
 		.select-number .number{
 			height:1.45em;
 			line-height:1.4em;
 		}
 		
 		.bottom{
 				height:3em;
 				background-color: #FFFFFF;
 				border-top: 1px solid rgba(230,230,230,.5);	
 				position:fixed;
 				bottom:0;
 				width:100%;
 			}
 			
 		.width-keep{
 			 -moz-box-sizing: border-box;  /*Firefox3.5+*/ 
 			-webkit-box-sizing: border-box; /*Safari3.2+*/ 
 			-o-box-sizing: border-box; /*Opera9.6*/
 			-ms-box-sizing: border-box; /*IE8*/ 
 		}
    </style>
</head>
<body>
   <div class="container" id="container">
   		<div class="page js_show home">
	    <div class="page preview js_show" id="box" style="text-align:center;">
			        
		</div>
	</div>
 </div>
 <div class="bottom">
 	<div class="form-select select-all" ch="f" style="z-index: 1;padding-top:0.7em;padding-left:15px;width:5em;">
       <img src="<?php echo base_url('static/appui/imgs/select.png');?>" style="width:1.3em;">
       <div style="display: inline-block;margin-left:0.2em;padding-top:0.4em;vertical-align: top;font-size:0.9em;">全选</div>
    </div>
    <div style="position:absolute;top:0;padding-left:7em;width:100%;height:100%;" class="width-keep">
    	<div style="float:left;width:60%;padding-top:1.3em;text-align:right;padding-right:1em;font-size:0.9em;" class="width-keep">合计：<span style="color: #b94a48;">￥<span class="total-price">0</span></span></div>
    	<div class="_submit_btn" style="float:left;height:100%;background-color: #ccc;color: #FFFFFF;width:40%;text-align:center;font-size:1em;padding-top:1.1em;">去结算</div>
    </div>
 </div>
 
 <script type="text/javascript">
	 
     var selectAll = $('.select-all'); 
     var checkedIcon = '<?php echo base_url('static/appui/imgs/selected.png');?>';
	 var checkIcon = '<?php echo base_url('static/appui/imgs/select.png');?>';
	 var totalPrice = $('.total-price');
	 var data,jsData,merData //数据
	 var changeObj = null;
	 var changeQuantity = 0;
	 var selectProduct = [];//购物车中选择的商品
	 var hasGoOrder = false; //是否允许下单[由于金额等限制 false不允许下单]
	var html_total = {}
		
	 function selectAlla(){
		var seNum = $('.weui-form-preview__bd').find('.select-item').length
		var tI = $('.weui-form-preview__bd').find('.select-item[ch="f"]').length;
		console.log(seNum)
		if(tI == 0 && seNum){
			selectAll.find('img').attr('src', checkedIcon);
			selectAll.attr('ch', 't');
		}else{
			selectAll.find('img').attr('src', checkIcon);
			selectAll.attr('ch', 'f');
		}
		//获取最终的选择
		var item = $('.item')
// 		console.log(item)
		selectProduct = []
		
		for (var i = 0; i < item.length; i++) {
			if ($(item[i]).children('.select-item').attr('ch') == 't') {
				var product_id = item[i].dataset['id'];
				var sort = item[i].dataset['sort'];
// 				$('.weui-form-preview').before('您的参数:'+JSON.stringify(jsData)+'<br>');
				//组合参数
				var temp = {
						"product_id":product_id,
						"sort":jsData[product_id][sort]['sort'],
						"quantity":jsData[product_id][sort]['quantity'],
						}
				selectProduct.push(temp)
// 				$('.weui-form-preview').before('您的参数:'+JSON.stringify(selectProduct)+'<br>');
			}
		}
// 		$('.weui-form-preview').before('您的参数:'+JSON.stringify(selectProduct)+'<br>');
// 		console.log(selectProduct)
	}

	function total(){
		
		var total = 0;
		var temData = {}
		$('.select-item[ch="t"]').each(function(){
			var p = $(this).parents('.item');
			var id = p.attr('data-id')
			var sort = p.attr('data-sort')
			var preview = p.parents('.weui-form-preview') //整个店铺div
			var name = preview.attr('data-name'); //列表商家整块的标签

			//累积商家金额
			if (typeof temData[name] == 'undefined') {
				temData[name] = 0
			}
			temData[name] = temData[name] + parseFloat(jsData[id][sort].price);//以商家角度来累积总金额
			console.log(temData)
			
			var price = parseFloat(jsData[id][sort].price);
			var quantity = parseFloat(jsData[id][sort].quantity);
			if(isNaN(price)) price = 0;
			total += price * quantity;
		});
// 		console.log(total)
		totalPrice.html(total);
		if (total > 0) {
			//金额大于0
			hasGoOrder = true;//允许下单
			$('._submit_btn').css("background-color","rgb(189, 38, 41)");
		}else{
			//金额大于0
			hasGoOrder = false;//允许下单
			$('._submit_btn').css("background-color","#ccc");
		}
		
		$.each(temData,function(merchant_id,total){
				
			if (merData[merchant_id].min_consume && total < merData[merchant_id].min_consume) {
				hasGoOrder = false;//一旦有错误就不允许下单了
				$('._submit_btn').css("background-color","#ccc");
			}
		})
	}

	 //通信对象
	 if( ! jsCxsm){
		 var jsCxsm = {
				 //预览订单
				 previewOrder:function(str){
					 previewOrder(str)
				 },
				 //请求接口
				 deal:function(urlDelete,map,funName){
					 deal(urlDelete,map,funName)
				 },
				 showspec:function(productId,sort){
					 showspec(productId,sort);
				}
				 
		 }	
//		 document.title = 'jsCxsm对象不存在，则说明你是ios';
	 }else{
//		 document.title = 'jsCxsm对象存在，则说明你是android';
	 }
	 
	$(function(){
		
		 data = eval('<?php echo json_encode($data);?>');
		 jsData = eval('(<?php echo json_encode($jsData);?>)');
		 merData = eval('(<?php echo json_encode($merData);?>)');
	
		console.log(data)
		console.log(jsData)
		console.log(merData)
		var html = '';

		$.each(data, function(k, v){
			html_total[v.merchant_id] = {}
			html += '<div class="weui-form-preview" data-name="'+v.merchant_id+'">';
			html += '<div class="weui-form-preview__bd">';
			html += '<div class="header">';
			html += '<div class="form-select store-select" ch="f">';
			html += '<input type="hidden">';
			html += '<img src="<?php echo base_url('static/appui/imgs/select.png');?>">';
			html += '</div>';
			html += '<div class="store-icon"><img src="<?php echo base_url('static/appui/imgs/store-icon.png');?>"/></div>';
			html += '<div class="store-name">';
			html += v.name;
// 			html += '(最低消费:'+merData[v.merchant_id].min_consume+')';
			html += '</div>';
			html += '<div class="action-btn" e="t">';
			html += '编辑';
			html += '</div>';
			html += '</div>';

			var product = v.products;
			
			$.each(product, function(kk,vv){
				html_total[v.merchant_id][vv.id+'_'+vv.sort] = 0
				html += '<div class="item" data-id="'+vv.id+'" data-sort="'+vv.sort+'">';
				html += '<div class="form-select select-item" ch="f">';
				html += '<input type="hidden">';
				html += '<img src="<?php echo base_url('static/appui/imgs/select.png');?>">';
				html += '</div>';
				html += '<div class="product-pic">';
				html += '<img src="'+vv.icon+'">';
				html += '</div>';
				html += '<div class="product-right">';
				html += '<div class="select-number hide">';
				html += '<div class="m-1 subtract left reduce"><img alt="" src="<?php echo base_url('static/appui/imgs/ic_shop_minu.png');?>"></div>';
				html += '<div class="m-2 number quantity">'+vv.quantity+'</div>';
				html += '<div class="m-1 right add"><img alt="" src="<?php echo base_url('static/appui/imgs/ic_shop_add.png');?>"></div>';
				html += '</div>';
				html += '<div class="name">';
				html += vv.name;
				html += '</div>';
				//是否可选规格
				html += '<div class="attribute';
				if (vv.property) {
					html += ' down_guige">'
					html += '规格：'
				}else{
					html += '　'//为了保持页面
				}
				html += '<span class="property">'+vv.property +'</span>';
				if (vv.is_variant == 1) {
					//有
					html += '<div class="down"><img alt="" src="<?php echo base_url('static/appui/imgs/down.png');?>"></div>';
				}else{
					//没有   隐藏
					html += '<div class="down" style="display: none;"><img alt="" src="<?php echo base_url('static/appui/imgs/down.png');?>"></div>';
				}
				
				html += '</div>';
				html += '<div class="price">';
				html += '<span class="money"><b>¥<span class="item-price">'+vv.price+'</span></b></span>';
				html += '<span class="Market-money">¥'+vv.market_price+'</span>';
				html += '<span class="Number">x<b class="quantity">'+vv.quantity+'</b></span>';
				html += '</div>';
				html += '<div class="delete-btn hide remove">删除</div>';
				html += '</div>';
				html += '</div>';
			});

			
			html += '</div>';
			html += '</div>';
			html += '';
		});
		console.log(html_total);
		if(html == ''){
			html = '<img src="<?php echo base_url('static/img/cart.png');?>" style="width: 35%;margin:0 auto;margin-top:30%;"/>';	
			html += '<div style="font-size: 0.85em;color: #999;">您的购物车还空空如也</div>';
			$('._submit_btn').css("background-color","#ccc");
		}

		
		$('#box').html(html);
		$('.store-select').click(function(){
			//选择店铺按钮
			var th = $(this);
			var checked = th.attr('ch');
			var allimg = th.parents('.weui-form-preview__bd').find('.select-item>img');
			if(checked == 'f'){
				allimg.attr('src', checkedIcon).parent().attr('ch', 't');
				th.find('img').attr('src', checkedIcon);
				th.attr('ch', 't');
				
			}else{
				allimg.attr('src', checkIcon).parent().attr('ch', 'f');
				th.find('img').attr('src', checkIcon);
				th.attr('ch', 'f');
			}
			selectAlla();
			total();
		});

		$('.select-item').click(function(){
			//商品选择
			var p = $(this).parents('.weui-form-preview__bd');
			var th = $(this);
			var checked = th.attr('ch');
			if(checked == 'f'){
				th.find('img').attr('src', checkedIcon);
				th.attr('ch', 't');
			}else{
				th.find('img').attr('src', checkIcon);
				th.attr('ch', 'f');
			}

			var tI = p.find('.select-item[ch="f"]').length;
			if(tI == 0){
				p.find('.store-select').attr('ch','t')
				p.find('.store-select>img').attr('src', checkedIcon);
			}else{
				p.find('.store-select>img').attr('src', checkIcon);
				p.find('.store-select').attr('ch','f')
			}
			selectAlla();
			total();
		});

		var formSelect = $('.form-select');
		selectAll.click(function(){
			//全选按钮
			var th = $(this);
			var checked = th.attr('ch');
			if(checked == 'f'){
				formSelect.find('img').attr('src', checkedIcon);
				formSelect.attr('ch', 't');
			}else{
				formSelect.find('img').attr('src', checkIcon);
				formSelect.attr('ch', 'f');
			}
			selectAlla()
			total();
		});

		$('.action-btn').click(function(){
			var th = $(this);
			var e = th.attr('e');
			var p = $(this).parents('.weui-form-preview__bd');
			var selectNumber = p.find('.select-number');
			var name = p.find('.name');
			var attribute = p.find('.attribute');
			var price = p.find('.price');
			var deleteBtn = p.find('.delete-btn');
			if(e == 't'){
				selectNumber.removeClass('hide');
				name.addClass('hide');
				price.addClass('hide');
				deleteBtn.removeClass('hide');
				attribute.addClass('edit');
				th.attr('e', 'f').html('完成');
			}else{
				selectNumber.addClass('hide');
				name.removeClass('hide');
				price.removeClass('hide');
				attribute.removeClass('edit');
				th.attr('e', 't').html('编辑');
				deleteBtn.addClass('hide');
			}
		});

// 		JSON.parse(str_data) //json转对象
		//JsCxsm android 对象
		$('._submit_btn').click(function(){
			str_data = JSON.stringify(selectProduct);
// 			console.log(JSON.parse(str_data));
			if ( str_data === '[]' || ! hasGoOrder) {
				return;
			}
			console.log(str_data);
			var param = {"product":str_data}
			str_param = JSON.stringify(param)
			jsCxsm.previewOrder(str_param);//提交预览订单方法
		})
		
		var urlEdit = '<?php echo getUrl('app/cart/edit')?>'

		//减少数量
		$('.reduce').click(function(){
			var item = changeObj = $(this).parents('.item')
			var id = item.attr('data-id')
			var sort = item.attr('data-sort')
			
			var map = {}//参数
			map['product_id'] = id;
			map['sort'] = sort;
			map['quantity'] = changeQuantity = parseInt(jsData[id][sort].quantity) - 1;
			map = JSON.stringify(map)
			console.log(map)
			//调用app方法调用接口
			jsCxsm.deal(urlEdit,map,'changeNumber')
	
		})
		
		//添加数量
		$('.add').click(function(){
			var item = changeObj = $(this).parents('.item')
			var id = item.attr('data-id')
			var sort = item.attr('data-sort')
			
			var map = {}//参数
			map['product_id'] = id;
			map['sort'] = sort;
			map['quantity'] = changeQuantity = parseInt(jsData[id][sort].quantity) + 1;
			map = JSON.stringify(map)
			console.log(map)
			//调用app方法调用接口
			jsCxsm.deal(urlEdit,map,'changeNumber')
	
		})
		
		var urlDelete = '<?php echo getUrl('app/cart/delete')?>'
		//删除商品
		$('.remove').click(function(){
			
			var item = changeObj = $(this).parents('.item')
			var id = item.attr('data-id')
			var sort = item.attr('data-sort')
			
			var map = {}//参数
			map['product_id'] = id;
			map['sort'] = sort;
			map = JSON.stringify(map)
			console.log(map)
			//调用app方法调用接口
			jsCxsm.deal(urlDelete,map,'removeProduct')
	
		})

		//更改规格
		$(".down_guige").on('click',function(){
			var item = changeObj = $(this).parents('.item')
			var id = item.attr('data-id')
			var sort = item.attr('data-sort')
// 			$('.weui-form-preview').before('您的参数:'+changeObj.attr('data-sort')+'<br>');
			jsCxsm.showspec(id,sort)
// 			setChangeVariant('{"status":1,"message":"\u5df2\u66f4\u6539","data":{"sort":"3","quantity":"10","property":"\u8349\u8393\/7\u5bf8\/\u5fae\u8fa3\/\u5c11\u91cf","price":250}}')
		})
		
	});

	/*
	 * 删除商品回调
	 */
	function removeProduct(data){
		var id = changeObj.attr('data-id')
		var sort = changeObj.attr('data-sort')
		var preview = changeObj.parents('.weui-form-preview') //整个店铺div
		var name = preview.attr('data-name'); //列表商家整块的标签
		
		changeObj.remove(); //删除当前对象
		delete jsData[id][sort] //删除数据对象
		delete html_total[name][id+'_'+sort]//删除页面对应数据对象

		//判断是否某商家订单删除完成
		if (JSON.stringify(html_total[name]) === '{}') {
			console.log('商品空了')
			delete html_total[name];//删除整个商家对象
			preview.remove()
			//判断是否全部商品删除完成
			if (JSON.stringify(html_total) === '{}') {
				//设置整个空页面
				console.log('整个商品空了')
				$('#box').html('');
				html = '<img src="<?php echo base_url('static/img/cart.png');?>" style="width: 35%;margin:0 auto;margin-top:30%;"/>';	
				html += '<div style="font-size: 0.85em;color: #999;">您的购物车还空空如也</div>';
				$('._submit_btn').css("background-color","#ccc");
				$('#box').html(html);
			}
		}
		selectAlla(); //重新计算
		total();
	}

	/*
	 * 更改商品数量回调
	 */
	function changeNumber(data){
 		var data = JSON.parse(data)
 		console.log(data)
 		setData(data);
	}

	/*
	 * 设置成功之后回调我
	 */
	function setChangeVariant(data){
// 		$('.weui-form-preview').before('您的参数:'+data);
 		var data = JSON.parse(data)
 		console.log(data)
 		setData(data);
	}

	//通用设置参数
	function setData(data) {
 		if (data.status == 1) {
// 		$('.weui-form-preview').before('进入了设置参数');
 			var id = changeObj.attr('data-id')
 			var sort = changeObj.attr('data-sort')
 			delete jsData[id][sort]; //清空以前的那个数据
 			sort = data.data.change_sort;
//  			$('.weui-form-preview').before('您的参数:'+sort+'<br>');

 			jsData[id][sort] = {};
 			jsData[id][sort].quantity 	= data.data.quantity;		//改变数据真实
 			jsData[id][sort].property 	= data.data.property;		//改变数据真实
 			jsData[id][sort].sort 		= data.data.change_sort;	//改变数据真实
 			jsData[id][sort].price 		= data.data.price;			//改变数据真实
 			
 			changeObj.find('.quantity').text(data.data.quantity);	//改变当前编辑器数量
 			changeObj.find('.property').text(data.data.property);
 			changeObj.find('.item-price').text(data.data.price);	//修改页面上单价
 			changeObj.attr('data-sort',data.data.change_sort);   	//将页面上设置成变更的sort
//  			$('.weui-form-preview').before('您的参数:'+changeObj.attr('data-sort')+'<br>');
 			
 			console.log(jsData)

			selectAlla();
			total();
		}
	}
	
	/*
	 * 测试方法
	 */
	function showName(name){
// 		var data = JSON.parse('{"status":1,"message":"\u5df2\u66f4\u6539","data":{"product_id":41}}').data
// 		$('.weui-form-preview').before('1'+changeQuantity);
		$('.weui-form-preview').before('1'+name);
		$('.name').text('1'+name)
	}


	

	
 </script>
</body>
</html>
